package com.lin.generate.config.datasource;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import lombok.Data;

/**
 * @description 数据源配置
 * @Author: z156940l@outlook.com
 * @className DataSourceBean
 * @Date: 2023/6/1 23:25
 */
@ConfigurationProperties(prefix = "spring.datasource.datasource")
@Component
@Data
public class DataSourceBean {
    private String url;
    private String userName;
    private String passWord;
    private String driverClassName="com.mysql.cj.jdbc.Driver";
    private Integer initialSize=5;
    private Integer minIdle=5;
    private Integer maxActive=20;
    private Integer maxWait=60000;
    private long timeBetweenEvictionRunsMillis=60000L;
    private long minEvictableIdleTimeMillis=300000L;
    private String validationQuery="SELECT 1 FROM DUAL";
    private Boolean testWhileIdle=true;
    private Boolean testOnBorrow=false;
    private Boolean testOnReturn=false;
    private Boolean poolPreparedStatements=true;
    private Integer maxPoolPreparedStatementPerConnectionSize=20;
    private String filters="stat,wall,log4j";
    private String connectionProperties="druid.stat.mergeSql=true;druid.stat.slowSqlMillis=1000";

    private String dataSourceName;

    public DataSourceBean() {}

    public DataSourceBean(String dataSourceName,String url,String userName,String passWord) {
        this.dataSourceName = dataSourceName;
        this.url = url;
        this.userName = userName;
        this.passWord = passWord;
    }
}
